import { useEffect } from 'react'
import { Select } from 'antd'
import { useSelector, useDispatch } from 'react-redux'
import { articleChannelsGet } from '@/store/actions/article'
export default function Channel(props) {
  const dispatch = useDispatch()
  const { channels } = useSelector((state) => state.article)
  useEffect(() => {
    dispatch(articleChannelsGet())
  }, [dispatch])
  return (
    <Select style={{ width: 200 }} placeholder='请选择频道' {...props}>
      {channels.map((item) => (
        <Select.Option value={item.id} key={item.id}>
          {item.name}
        </Select.Option>
      ))}
    </Select>
  )
}
